/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mvp.levelup.threads;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author WORKSPOT2
 */
public class Storage
{

    private List<String> all;

    public Storage()
    {
        all = new ArrayList<String>();
    }

    public void addElement(String elem)
    {
        synchronized (all)
        {
            all.add(elem);
        }
    }

    public String findString(String toFind)
    {
        synchronized (all)
        {
            Iterator<String> iter = all.iterator();
            String tmp;
            while (iter.hasNext())
            {
                tmp = iter.next();
                if (tmp.equals(toFind))
                {
                    return tmp;
                }
            }
            return "";
        }
    }
}
